package ding.com.multifragment;


import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;


/**
 * create an instance of this fragment.
 */
public class BlankFragment extends BaseFragment {
    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;


    public BlankFragment() {
        // Required empty public constructor
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_blank, container, false);
        view.findViewById(R.id.bt1).setOnClickListener(new View.OnClickListener() {//无参无返回
            @Override
            public void onClick(View view) {
                mFuntionsManager.invokeFuntion("无参无返回");
            }
        });
        view.findViewById(R.id.bt2).setOnClickListener(new View.OnClickListener() {//无参有返回
            @Override
            public void onClick(View view) {
                String str=mFuntionsManager.invokeFuntion("无参有返回",String.class);
                Toast.makeText(mainActivity,"fragment弹出："+str,Toast.LENGTH_SHORT).show();
            }
        });
        view.findViewById(R.id.bt3).setOnClickListener(new View.OnClickListener() {//有参无返回
            @Override
            public void onClick(View view) {
                mFuntionsManager.invokeFuntion("有参无返回","av");
            }
        });
        view.findViewById(R.id.bt4).setOnClickListener(new View.OnClickListener() {//有参有返回
            @Override
            public void onClick(View view) {
                String str=mFuntionsManager.invokeFuntion("有参有返回","av",String.class);
                Toast.makeText(mainActivity,"fragment弹出："+str,Toast.LENGTH_SHORT).show();
            }
        });
        return view;
    }

}
